<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/

use Illuminate\Support\Facades\Route;

Route::post('/test', 'App\TestController@index');

Route::get('/', function () {
    return "\t\tGameAPI项目 \r\nCopyRight";
});

/**
 * 抽奖游戏
 */
Route::group(['middleware' => ['app', 'cors', 'auth']], function () {

    Route::group(['middleware' => ['drawOpenCheck:stellar']], function () {
        Route::get('/api/lotteryStellar/illustration', 'App\LotteryStellarController@illustration'); // 游戏说明
        Route::get('/api/lotteryStellar/user', 'App\LotteryStellarController@user'); // 用户信息
        Route::get('/api/lotteryStellar/prize', 'App\LotteryStellarController@prizes'); // 奖品列表
        Route::post('/api/lotteryStellar/prize', 'App\LotteryStellarController@draw'); // 抽奖
        Route::post('/api/lotteryStellar/swap', 'App\LotteryStellarController@swap'); // 兑换
        Route::get('/api/lotteryStellar/rank', 'App\LotteryStellarController@rank'); // 排行榜
        Route::get('/api/lotteryStellar/balance', 'App\LotteryStellarController@balance'); // 用户余额
        Route::get('/api/lotteryStellar/notifyList', 'App\LotteryStellarController@getNotifyGiftList'); // 用户余额
        Route::post('/api/lotteryStellar/setAuto', 'App\LotteryStellarController@setAuto'); // 设置自动兑换游戏道具

        Route::get('/api/lotteryStellar/prizeListByValue','App\LotteryStellarController@prizeListByValue'); //获取超过指定金额礼物列表
        Route::get('/api/lotteryStellar/drawRecord','App\LotteryStellarController@drawRecord'); //游戏记录
    });
    # 碎片游戏
    Route::group(['middleware' => ['drawOpenCheck:frag'],'prefix' => "/api/lotteryFrag"], function () {
        Route::get('/illustration', 'App\LotteryFragController@illustration'); // 游戏说明
        Route::get('/user', 'App\LotteryFragController@user'); // 用户信息
        Route::get('/prize', 'App\LotteryFragController@prizes'); // 奖品列表
        Route::post('/prize', 'App\LotteryFragController@draw'); // 抽奖
        Route::post('/swap', 'App\LotteryFragController@swap'); // 兑换
        Route::get('/rank', 'App\LotteryFragController@rank'); // 排行榜
        Route::get('/balance', 'App\LotteryFragController@balance'); // 用户余额
        Route::get('/notifyList', 'App\LotteryFragController@getNotifyGiftList'); // 用户余额
        Route::post('/setAuto', 'App\LotteryFragController@setAuto'); // 设置自动兑换游戏道具
        Route::get('/prizeListByValue','App\LotteryFragController@prizeListByValue'); //获取超过指定金额礼物列表
        Route::get('/drawRecord','App\LotteryFragController@drawRecord'); //游戏记录

        Route::get('/fragmentGiftList','App\LotteryFragController@fragmentGiftList');//配置碎片礼物列表
        Route::post('/shopBuy','App\LotteryFragController@shopBuy');//碎片兑换礼物
        Route::post('/protocol', 'App\LotteryFragController@protocol');//同意协议
        Route::get('/fragmentRecordList','App\LotteryFragController@getFragmentUserRecordList'); //用户碎片记录
        Route::get('/fragmentIllustration', 'App\LotteryFragController@fragmentIllustration'); //碎片说明
    });

});

/**
 * 盲盒
 */
Route::group(['prefix' => 'api/blindBox', 'middleware' => ['app', 'cors', 'auth']], function () {

    // 抽奖
    Route::post('/prize', 'App\BlindBoxController@draw');

    // 获取奖池兑换奖品
    Route::get('/exchangeGift/list', 'App\BlindBoxController@getExchangeGiftList');

    // 获取用户盲盒礼物列表
    Route::get('/user/gift/list', 'App\BlindBoxController@getUserBlindBoxGiftList');

    // 获取用户抽奖记录列表
    Route::get('/user/drawRecord/list', 'App\BlindBoxController@getUserDrawRecordList');

    // 兑换奖品
    Route::post('/user/prize/exchange', 'App\BlindBoxController@exchangePrize');

    // 获取盲盒单个池子的奖品
    Route::get('/gift/list', 'App\BlindBoxController@getBoxGiftList');

});

Route::group(['middleware' => ['cors', 'auth_api', 'app']], function () {
    Route::post('/api/lottery/clearPoolPrize', 'App\LotteryController@clearPoolPrize'); // 游戏后台清除奖池
});


Route::group(['middleware' => ['cors', 'auth_api', 'app'], 'namespace' => 'App', 'prefix' => 'api/lottery_draw'], function () {
    //补池策略列表
    Route::get('/add_pool_config/list', 'LotteryDrawController@list');
    //补池策略修改/添加
    Route::post('/add_pool_config/save', 'LotteryDrawController@save');
    //补池策略删除
    Route::post('/add_pool_config/delete', 'LotteryDrawController@delete');

    //后台获取补池金额
    Route::get('/add_pool_account/getGameAccount', 'LotteryDrawController@getGameAccount');
    //后台更改补池金额
    Route::post('/add_pool_account/changeGameAccount', 'LotteryDrawController@changeGameAccount');
    //补池金额记录
    Route::get('/add_pool_account/record', 'LotteryDrawController@getAddPoolAccountRecord');

    //游戏判定列表
    Route::get('/check/checkList', 'LotteryDrawController@checkList');
    //游戏判定修改/添加
    Route::post('/check/checkSave', 'LotteryDrawController@checkSave');
    //游戏判定删除
    Route::post('/check/checkDelete', 'LotteryDrawController@checkDelete');
    //游戏判定记录
    Route::get('/check/record', 'LotteryDrawController@getCheckRecord');

    //礼物阈值列表
    Route::get('/gift/config', 'LotteryDrawController@getGiftConfig');
    //礼物阈值保存
    Route::post('/gift/configSave', 'LotteryDrawController@setGiftConfig');

    //指定补偿列表
    Route::get('/gift/appoint', 'LotteryDrawController@getAppointGift');
    //指定补偿保存
    Route::post('/gift/appointSave', 'LotteryDrawController@setAppointGift');

    //游戏概览-用户列表
    Route::get('/whole_game/user', 'LotteryDrawController@getWholeGameUser');
    //游戏概览-判定记录
    Route::get('/whole_game/checkRecord', 'LotteryDrawController@getWholeGameCheckRecord');
    //游戏概览-判定规则列表
    Route::get('/whole_game/checkList', 'LotteryDrawController@getWholeGameCheckList');
    //游戏概览-新增/修改判定规则
    Route::post('/whole_game/checkSave', 'LotteryDrawController@wholeGameCheckSave');
    //游戏概览-删除判定规则
    Route::post('/whole_game/checkDelete', 'LotteryDrawController@wholeGameCheckDelete');

    //展示区动画分类 列表
    Route::get('/display_cate/list', 'LotteryDrawController@getDisplayCate');
    //展示区动画分类 修改/添加
    Route::post('/display_cate/save', 'LotteryDrawController@setDisplayCate');
    //展示区动画分类 删除
    Route::post('/display_cate/delete', 'LotteryDrawController@displayCateDel');

});


//// 新游戏  2023  zxx  auth // 获取user值    app 参数验签
Route::group(['middleware' => ['cors', 'auth', 'app'], 'namespace' => 'App\Game\V1'], function () {
    // 暴击金币
    Route::group(['namespace' => 'Lucky', 'prefix' => 'api/game_lucky'], function () {
        // 兑换金币
        Route::post('/strike/exchange', 'StrikeController@exchange');
        // 获取用户信息
        Route::get('/strike/user', 'StrikeController@userInfo');
        // 获取兑换信息
        Route::get('/strike/setting', 'StrikeController@setting');
    });
    // 糖果城堡
    Route::group(['namespace' => 'Castle', 'prefix' => 'api/game_castle'], function () {
        // 兑换金币
        Route::get('/exchange', 'CastleController@exchange');
        // 规则 用户钱包 信息  开奖记录 10 最近10 条
        Route::get('/info', 'CastleController@info');
        Route::get('/exchangeInfo', 'CastleController@exchangeInfo');
        Route::post('/gameBet', 'CastleController@gameBet');
        Route::get('/pastList', 'CastleController@past');
        Route::get('/userList', 'CastleController@past');
        Route::get('/gameResult', 'CastleController@gameResult');
        Route::get('/drawRank', 'CastleController@drawRank');
        Route::get('/drawLog', 'CastleController@drawLog');
        Route::get('/shopItem', 'CastleController@shopItem'); // 兑换礼物列表
        Route::post('/shopBuy', 'CastleController@shopBuy'); // 用户兑换礼物
    });

});




